//package top.tenebrous.yzl.grpc;
//
//import com.google.protobuf.Any;
//import io.grpc.stub.StreamObserver;
//import lombok.extern.slf4j.Slf4j;
//import net.devh.boot.grpc.server.service.GrpcService;
//import top.tenebrous.yzl.grpc.proto.common.GrpcResponse;
//import top.tenebrous.yzl.grpc.proto.common.RetCode;
//import top.tenebrous.yzl.grpc.proto.heatbeat.HeatBeatRequest;
//import top.tenebrous.yzl.grpc.proto.heatbeat.HeatBeatResponse;
//import top.tenebrous.yzl.grpc.proto.heatbeat.HeatBeatServerGrpc;
//
///**
// * @author yazhang6
// */
//@Slf4j
//@GrpcService
//public class HeatBeatServiceGrpcImpl extends HeatBeatServerGrpc.HeatBeatServerImplBase {
//
//    @Override
//    public StreamObserver<HeatBeatRequest> accept(StreamObserver<GrpcResponse> responseObserver) {
//
//        return new StreamObserver<HeatBeatRequest>() {
//            @Override
//            public void onNext(HeatBeatRequest heatBeatRequest) {
//                log.info("HeatBeatServiceGrpcImpl.accept.onNext.request:[serverName:{} instanceId:{}]", heatBeatRequest.getServerName(), heatBeatRequest.getInstanceId());
//                //
//                HeatBeatResponse beatResponse = HeatBeatResponse.newBuilder().setServerId(heatBeatRequest.getInstanceId()).setServerName(heatBeatRequest.getServerName()).setServerId(heatBeatRequest.getServerId()).build();
//                GrpcResponse response = GrpcResponse.newBuilder().setRetMsg(RetCode.SUCCESS.name()).setRetCode(RetCode.SUCCESS).setData(Any.pack(beatResponse)).build();
//                responseObserver.onNext(response);
//            }
//
//            @Override
//            public void onError(Throwable throwable) {
//                log.error("HeatBeatServiceGrpcImpl.accept.onError:{}", throwable.getMessage());
//            }
//
//            @Override
//            public void onCompleted() {
//                log.info("响应消息完成");
//                responseObserver.onCompleted();
//            }
//        };
//    }
//}
